adicionando rotas v2 link de pagamento (criacao e edicao) e de assina…#12
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds V2 routes for Payment Links (create and update) and Subscriptions (create and update) to the iPag SDK. It also adds an Owner relationship to the Customer model and adjusts dependency versions for PHP 7.4 compatibility.
Changes:
- New model classes (
SubscriptionV2,Plan,PlanTrial,PaymentLinkV2,CheckoutSettings) and their corresponding endpoint classes, registered inIpagClient. - Added
Ownerrelationship to theCustomermodel with getter/setter and minor formatting changes. - Updated
composer.jsonto pin PHP 7.4.33 platform and adjustedcomposer.lockdependencies accordingly (e.g.,psr/log1.1.4,doctrine/instantiator1.5.0).
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Model/SubscriptionV2/SubscriptionV2.php | New model for V2 subscriptions with schema, mutator, getters/setters |
| src/Model/SubscriptionV2/Plan.php | New Plan sub-model for inline plan definitions in subscriptions |
| src/Model/SubscriptionV2/PlanTrial.php | New PlanTrial sub-model for trial configuration |
| src/Model/PaymentLinkV2/PaymentLinkV2.php | New model for V2 payment links with date format validation |
| src/Model/PaymentLinkV2/CheckoutSettings.php | New CheckoutSettings sub-model for payment link checkout config |
| src/Model/Customer.php | Added Owner relationship and minor formatting cleanup |
| src/Endpoint/SubscriptionV2Endpoint.php | New endpoint with create/update methods for V2 subscriptions |
| src/Endpoint/PaymentLinksV2Endpoint.php | New endpoint with create/update/get/list/listTransactions for V2 payment links |
| src/Core/IpagClient.php | Registered new V2 endpoint accessors |
| tests/Model/SubscriptionV2Test.php | Unit tests for SubscriptionV2 model |
| tests/Model/PaymentLinkV2Test.php | Unit tests for PaymentLinkV2 model |
| tests/Endpoint/SubscriptionV2EndpointTest.php | Endpoint integration tests for V2 subscriptions |
| tests/Endpoint/PaymentLinksV2EndpointTest.php | Endpoint integration tests for V2 payment links |
| examples/subscription_v2/*.php | Example usage scripts for V2 subscriptions |
| examples/payment_links_v2/*.php | Example usage scripts for V2 payment links |
| composer.json | Added PHP 7.4.33 platform constraint and audit ignore |
| composer.lock | Updated dependency versions for PHP 7.4 compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| protected function schema(SchemaBuilder $schema): Schema | ||
| { | ||
| $schema->int('max_installments')->nullable(); | ||
| $schema->float('min_installment_value')->nullable(); | ||
| $schema->float('interest')->nullable(); | ||
| $schema->int('interest_free_installments')->nullable(); | ||
| $schema->int('fixed_installment')->nullable(); | ||
| $schema->string('payment_method')->nullable(); | ||
|
|
||
| return $schema->build(); | ||
| } |
There was a problem hiding this comment.
CheckoutSettings does not override jsonSerialize() to filter null values, unlike the other new model classes (SubscriptionV2, Plan, PlanTrial, PaymentLinkV2) which all include return array_filter(parent::jsonSerialize(), fn($v) => !is_null($v));. This inconsistency means null fields will be sent to the API when CheckoutSettings is serialized as part of a PaymentLinkV2 request. Consider adding the same jsonSerialize() override.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tura (create e update)